package cn.fayang.ymcc.web.controller;

import cn.fayang.ymcc.dto.RegisterDto;
import cn.fayang.ymcc.result.JSONResult;
import cn.fayang.ymcc.service.IVerifyCodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/verifycode")
public class VerifyCodeController {
    @Autowired
    private IVerifyCodeService verifyCodeService;

    @GetMapping("/image/{imageCodeKey}")
    public JSONResult imageCode(@PathVariable("imageCodeKey")String key){
        String base64Str = verifyCodeService.imageCode(key);
        return JSONResult.success(base64Str);
    }

    @PostMapping("/smsCode")
    public JSONResult smsCode(@RequestBody RegisterDto registerDto){
        verifyCodeService.smsCode(registerDto);
        return JSONResult.success();
    }
}



